#include "Ball.h"

#include "glut.h"
#include <math.h>

Ball::Ball(){
    zone=1;
    progress=0;
    speed = 1.0;
    margins = 20;
    x = 0.0;
    y = 0.0;
    z = 0.0;
    isDying = false;
}

Ball::~Ball(){}

void Ball::setZone(int fpos,int nbtracks){
    zone=floor((double)(fpos+160.0-margins)/(320.0-2*margins)*nbtracks);
}

int Ball::getZone(){
    return zone;
}

void Ball::setProgress(float p){
    progress += p;
}

float Ball::getProgress(){
    return progress;
}

void Ball::setXposition(double xpos){
    x = xpos;
}

void Ball::decAltitude(float tim){
    y -= 10.0*tim;
}

double Ball::getAltitude(){
    return y;
}

double Ball::getXposition(){
    return x;
}

void Ball::draw(){
    glutSolidSphere(0.5,30,30);
}
